<template>
  <Dialog v-model="dialogVisible" title="授权计量二维码" width="380">
    <div class="qr-box">
      <Qrcode :text="content" :width="280" :options="options"></Qrcode>
    </div>
    <template #footer>
      <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
    </template>
  </Dialog>
</template>
<script lang="ts" setup>
  import { getTenantId } from '@/utils/auth'
  import * as salesPlanApi from '@/api/salesPlan'

  const dialogVisible = ref(false)
  const content = ref('')
  const options = ref({
    margin: 0,
    width: 280,
    height: 280,
    correctLevel: "H"
  })

  const open = async () => {
    content.value = `${import.meta.env.VITE_DIAOYUN_URL}?appid=${import.meta.env.VITE_DIAOYUN_APPID}&path=/packageA/pages/login?flag=1#wechat-redirect`
    dialogVisible.value = true
  }

  defineExpose({ open })
</script>
<style lang="scss" scoped>
  .custom-dialog .el-dialog__body {
    color: #303133;
    padding: 20px 24px !important;
  }

  .qr-box {
    text-align: center;
  }
</style>